package top.wyix.module.test.service;

import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import top.wyix.framework.common.exception.ServerException;
import top.wyix.framework.common.exception.ServiceException;
import top.wyix.module.test.controller.admin.framework.vo.ValDemoReq;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

/**
 * @author wangdx
 */
@Service
@Validated
public class ValidateServiceImpl implements IValidateService {

    @Override
    public Object validate(@NotNull @Min(10) Integer id, @NotNull String name) {
        return "校验参数测试";
    }

    @Override
    public Object validateEn(ValDemoReq valDemoReq) {
        return "校验参数测试";
    }

    @Override
    public Object hello(Integer id, String name) {
        if (name.contains("wdx")) {
            throw new ServiceException(400, "异常信息");
        }
        return null;
    }
}
